<%@ page contentType="text/html; charset=utf-8" language="java" import="java.util.*" pageEncoding="utf-8" errorPage="" %>
<%@ page import="club325.webchat.servlet.user.UserInfoManager" %>
<%@ page session="false" %>

<%
	String tip = null;
	tip = (String)request.getAttribute("tip");
	
	String[] questions = UserInfoManager.getQuestions();
	String name = request.getParameter("username");
	String question = request.getParameter("question");
	String sex = request.getParameter("sex");
	String birthday = request.getParameter("birthday");
	String address = request.getParameter("address");
	String email = request.getParameter("email");
	String qq = request.getParameter("qq");
	String msn = request.getParameter("msn");
	
	if (name == null) { name = ""; };
	if (question == null) { question = questions[0]; };
	if (sex == null) { sex = "保密"; };
	if (birthday == null) { birthday = ""; };
	if (address == null) { address = ""; };
	if (email == null) { email = ""; };
	if (qq == null) { qq = ""; };
	if (msn == null) { msn = ""; };
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/background.dwt.jsp" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>新用户注册</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Keywords" content="WebChat,Chat" />
<meta http-equiv="Description" content="Chatting on Web" />
<link href="/WebChat/style/register.css" rel="stylesheet" type="text/css" />
<script src="/WebChat/SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="/WebChat/SpryAssets/SpryValidationConfirm.js" type="text/javascript"></script>
<link href="/WebChat/SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="/WebChat/SpryAssets/SpryValidationConfirm.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
<link href="/WebChat/style/global.css" rel="stylesheet" type="text/css" />
<link href="/WebChat/style/template.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="top">
  <div id="top_main">
    <ul>
      <li><a href="#">设为首页</a>|</li>
      <li><a href="#">会员注册</a>|</li>
      <li><a href="#">用户登录</a>|</li>
      <li><a href="#">联系我们</a></li>
    </ul>
  </div>
</div>
<!-- InstanceBeginEditable name="EditRegion_mian" -->
<div id="main">
  <div id="show_top">
    <p><img src="/WebChat/images/home_logo.png" width="16" height="16" alt="home_logo" />WebChat 用户注册</p>
  </div>
  <div id="show_main">
    <h1 id="tip"><% if (tip == null) { %>请您按提示填写用户信息...<% } else { %> <%= tip %> <% } %></h1>
    <form id="form_register" name="form_register" method="post" action="/WebChat/servlet/RegisterServlet">
    <table width="700px" border="0" cellpadding="0" cellspacing="6">
      <tr>
        <th scope="row" width="260">用户名<p>*(由5~12位数字和字母组成)</p> :</th>
        <td width="440"><span id="spry_username">
          <input name="username" type="text" id="username" class="middle" maxlength="12" value="<%= name %>" />
          <span class="textfieldRequiredMsg">用户名不能为空</span><span class="textfieldInvalidFormatMsg">格式无效</span></span>
        </td>
      </tr>
      <tr>
        <th scope="row">密码<p>*(由6~16位数字和字母组成)</p> :</th>
        <td><span id="spry_password">
          <input name="password" type="password" id="password" class="middle" maxlength="16" value="" />
          <span class="textfieldRequiredMsg">密码不能为空</span><span class="textfieldInvalidFormatMsg">格式无效</span></span>
        </td>
      </tr>
      <tr>
        <th scope="row">确认密码<p>*</p> :</th>
        <td><span id="spry_confirm">
          <input name="confirm" type="password" id="confirm" class="middle" maxlength="16" value="" />
          <span class="confirmRequiredMsg">确认密码不能为空</span><span class="confirmInvalidMsg">与第一次输入的密码不一致</span></span>
        </td>
      </tr>
      <tr>
        <th scope="row">密码保护问题<p>*</p> :</th>
        <td><select name="question" class="list" id="question" >
        <%
        	for (int i = 0; i < questions.length; i++) {
        		if (question.equals(questions[i])) {
        %>
          <option value="<%= questions[i] %>" selected="selected"><%= questions[i] %></option>
        <%
        		} else {
        %>
          <option value="<%= questions[i] %>"><%= questions[i] %></option>
        <%
        		}
        	}
        %>
          </select>
        </td>
      </tr>
      <tr>
        <th scope="row">密码保护问题答案<p>*</p> :</th>
        <td><span id="spry_answer">
          <input type="text" name="answer" id="answer" class="large" value="" />
          <span class="textfieldRequiredMsg">答案不能为空</span></span>
        </td>
      </tr>
      <tr>
        <th scope="row">性别<p>*</p> :</th>
        <td>
          <label class="radio"><input type="radio" name="sex" value="男" id="sex_male" <% if (sex.equals("男")) { %> checked="checked" <% } %>/>男</label>
          <label class="radio"><input type="radio" name="sex" value="女" id="sex_female" <% if (sex.equals("女")) { %> checked="checked" <% } %> />女</label>
          <label class="radio"><input type="radio" name="sex" value="保密" id="sex_secret" <% if (sex.equals("保密")) { %> checked="checked" <% } %> />保密</label>
        </td>
      </tr>
      <tr>
        <th scope="row">生日<p>(例:2010-10-21)</p> :</th>
        <td><span id="spry_birthday">
          <input type="text" name="birthday" id="birthday" class="middle" value="<%= birthday %>" />
          <span class="textfieldInvalidFormatMsg">格式无效</span></span>
        </td>
      </tr>
      <tr>
        <th scope="row">家庭地址 :</th>
        <td><input type="text" name="address" id="address" class="large" value="<%= address %>" /></td>
      </tr>
      <tr>
        <th scope="row">email :</th>
        <td><span id="spry_email">
          <input type="text" name="email" id="email" class="large" value="<%= email %>" />
          <span class="textfieldInvalidFormatMsg">格式无效</span></span>
        </td>
      </tr>
      <tr>
        <th scope="row">QQ号 :</th>
        <td><span id="spry_qq">
          <input type="text" name="qq" id="qq" class="middle" value="<%= qq %>" />
          <span class="textfieldInvalidFormatMsg">格式无效</span></span>
        </td>
      </tr>
      <tr>
        <th scope="row">MSN帐号 :</th>
        <td><span id="spry_msn">
          <input type="text" name="msn" id="msn" class="large" value="<%= msn %>" />
          <span class="textfieldInvalidFormatMsg">格式无效</span></span>
        </td>
      </tr>
    </table>
      <h2>(标记为*号的是必填项目)</h2>
      <input type="submit" name="submit" id="submit" value="" />
      <input type="reset" name="reset" id="reset" value="" />
    </form>
  </div>
  <div id="show_bottom"></div>
</div>
<script type="text/javascript">
<!--
	var spryUsername = new Spry.Widget.ValidationTextField("spry_username", "username", {validateOn:["change"], isRequired:true});
	var spryPassword = new Spry.Widget.ValidationTextField("spry_password", "password", {validateOn:["change"], isRequired:true});
	var spryConfirm = new Spry.Widget.ValidationConfirm("spry_confirm", "password", {validateOn:["change"]});
	var spryAnswer = new Spry.Widget.ValidationTextField("spry_answer", "answer", {validateOn:["change"], isRequired:true});
	var spryBirthday = new Spry.Widget.ValidationTextField("spry_birthday", "date", {validateOn:["change"], format:"yyyy-mm-dd", isRequired:false});
	var spryEmail = new Spry.Widget.ValidationTextField("spry_email", "email", {validateOn:["change"], isRequired:false});
	var spryQQ = new Spry.Widget.ValidationTextField("spry_qq", "qq", {validateOn:["change"], isRequired:false});
	var spryMSN = new Spry.Widget.ValidationTextField("spry_msn", "email", {validateOn:["change"], isRequired:false});
//-->
</script>
<!-- InstanceEndEditable -->
<div id="bottom">
  <p>Copyright © 2009 - 2010 CLUB325.  All Rights Reserved<br/>
  CLUB325  版权所有</p>
</div>
</body>
<!-- InstanceEnd --></html>
